home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++,comp.os.msdos.programmer
- Path: actrix.gen.nz!kheidens
- From: kheidens@atlantis.actrix.gen.nz (Kris Heidenstrom)
- Subject: Re: Timer (0x1C) Interrupt exactly 18.2 seconds?
- Message-ID: <Dn7qnK.4EK@actrix.gen.nz>
- Sender: news@actrix.gen.nz (News Administrator)
- Organization: Actrix - Internet Services
- Date: Fri, 23 Feb 1996 05:16:32 GMT
- References: <4givrv$cim@midland.co.nz>
- X-Nntp-Posting-Host: atlantis.actrix.gen.nz
-
- In article <4givrv$cim@midland.co.nz>,
- Jarrod S Lowe <lowefam@igrin.co.nz> wrote:
- > Hi
- >
- > I have a C++ Program (on DOS) in which a function is attached to the
- > Timer (0x1C) Interrupt.
- >
- > The function has a static int to count the number of times it has been
- > called. Every 'x' calls, It executes another function.
- >
- > 'x' is 546, which one would expect to result in the function being
- > called every 30 seconds. However, it is called every 29 point
- > something seconds. Over 5 minutes you can see it has drifted. If I had
- > one to 'x' (now 547) it is called every 30 point something seconds -
- > the same problem in reverse.
-
- Right. The timer tick rate is about 18.2065 ticks per second or one
- tick every 54.9254 ms. The exact rate is 14318180/12/65536 ticks per
- second.
-
- > This program is expected to run, continually, for YEARS - so a drift
- > that shows up in 5 minutes will make it unusable.
-
- Typical accuracy for this clock is 20 to 50 ppm. If you want any
- reasonable long term accuracy you will still have to synchronise
- your program with some external timebase.
-
- There are tricks you can use to obtain a useful interrupt rate (though
- of course the basic clock frequency accuracy is dictated by hardware
- and cannot be improved by software alone). This stuff is covered in
- detail in my Timing FAQ:
- ftp://ftp.coast.net/SimTel/msdos/info/pctim003.zip.
-
- > (lowefam@igrin.co.nz)
-
- Good luck, email me if you want more info.
-
- Kris
- --
- Kris Heidenstrom kheidens@actrix.gen.nz Wellington, NZ
- "Silly Pate - Tastes great... Bounces high!" - AWotM
-